<%layout("/common/layout.html"){%>

<div class="row">
    <div class="col-md-4">
        <br>
        <br>
        <ul class="nav nav-pills nav-stacked text-center">
            <li><a href="${ctxPath}/user/myInfo">我的信息编辑</a></li>
            <li><a href="${ctxPath}/user/myOrder">我的订单</a></li>
            <li><a href="${ctxPath}/user/myCollect">我的收藏</a></li>
            <li class="active"><a href="#">我的私信</a></li>
            <li><a href="${ctxPath}/user/myNotice">我的通知</a></li>
        </ul>
    </div>


    <div class="col-md-8">
        <div class="row">
            <div class=" col-md-offset-1 left pro">
                <div class="my-mes">
                    <span class="mes">我的私信</span>
                    <button type="button" class="btn btn-primary btn-sm pull-right" id="write-mes"
                            data-toggle="modal" data-target="#Modal"><span
                            class="glyphicon glyphicon-envelope"></span>写私信
                    </button>
                    <div class="clear-fix"></div>
                </div>
                <div class="message-box">

                    <%if(has(none)){%>
                    <div class="mess-none">还没有人给你发私信，不如你主动一点，给神交已久的知友发一封问候私信吧:)
                    </div>
                    <%}%>

                    <%for(msg in page.list){%>
                    <%if(msg.to_id==session.user.id){%>
                    <div class="mess-list">
                        <div class="head"><img src="${session.user.img}" class="img-thumbnail" alt=""
                                               width="65px"
                                               height="65px"></div>
                        <div class="mes-two-sides">
                            <div class="user"><span class="name">${msg.to_user.name}</span>
                                <%if(msg.read_A==false){%>
                                <span class="res-con">新回复!</span>
                                <%}%>
                            </div>
                            <div class="date-time"><span class="day">${printTime(msg.time)}</span>&nbsp;
                            </div>
                        </div>
                        <div class="action"><a href="${ctxPath}/message/check?message=${msg.id}" title=""><span
                                class="total">查看</span></a><span
                                class="ver-line">|</span><span class="del" data-toggle="modal"
                                                               data-target="#Modal-del">删除</span>
                        </div>
                    </div>

                    <%}else{%>

                    <div class="mess-list">
                        <div class="head"><img src="${msg.to_user.img}" class="img-thumbnail" alt=""
                                               width="65px"
                                               height="65px"></div>
                        <div class="mes-two-sides">
                            <div class="user">我发送给<span class="name">${msg.to_user.name}</span>
                                <%if(msg.read_A==false){%>
                                <span class="res-con">新回复!</span>
                                <%}%>
                            </div>
                            <div class="date-time"><span class="day">${printTime(msg.time)}</span>&nbsp;
                            </div>
                        </div>
                        <div class="action"><a href="${ctxPath}/message/check?message=${msg.id}" title=""><span
                                class="total">查看</span></a><span
                                class="ver-line">|</span><span class="del" data-toggle="modal"
                                                               data-target="#Modal-del">删除</span>
                        </div>
                    </div>
                    <%}%>
                    <%}%>

                    <nav class="row text-center">
                        <%include("/common/paginate.html",{"currentPage":page.pager.pageNumber,"totalPage":page.pager.pageCount,"actionUrl":actionUrl}){}%>
                    </nav>

                </div>
            </div>

        </div>

    </div>
</div>

<div class="modal fade" id="Modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog ui-widget-content ms-box" id="draggable">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">发送私信</h4>
            </div>
            <div class="modal-body">
                <form action="" method="POST">
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">发给:</label>
                        <input type="text" class="form-control" id="recipient-name" name="recipient-name" placeholder="搜索用户">
                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">内容:</label>
                        <textarea class="form-control" id="message-text" name="message-text" cols="500"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-undo">取消</button>
                <button type="submit" class="btn btn-primary">发送</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="Modal-del">
    <div class="modal-dialog ui-widget-content" id="draggable-del">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">删除私信会话</h4>
            </div>
            <div class="modal-body">
                <p>你确定要删除与<span class="name"></span>的所有会话吗？&hellip;</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-undo">取消</button>
                <button type="button" class="btn btn-primary">确认</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<div class="modal fade" id="Modal-del-detail">
    <div class="modal-dialog ui-widget-content" id="draggable-del-detail">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">删除私信会话</h4>
            </div>
            <div class="modal-body">
                <p>你确定要删除这条消息吗？</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-undo">取消</button>
                <button type="button" class="btn btn-primary">确认</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<%include("/common/footer.html"){}%>

<script type="text/javascript" src="${ctxPath}/js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="${ctxPath}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctxPath}/js/nav.js"></script>



<%}%>